﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Fake_Shop_WebApi.ResourceParameters
{
    public class TouristRouteResourceParamaters
    {
        public string keyword { get; set; }       
        public string ratingOperator { get; set; }
        public int? ratingValue { get; set; }
        public string _rating { get; set; }
        public string Rating { get 
            {
                return _rating;
            } set {
                Regex regex = new Regex(@"([a-zA-Z0-9\-]+)(\d+)");
                Match math = regex.Match(value);
                if (math.Success)
                {
                    ratingOperator = math.Groups[1].Value;
                    ratingValue = int.Parse(math.Groups[2].Value);
                }
                _rating = value;
            } }
    }
}
